#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget* parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
    , m_pMainForm(new MainForm)
    , m_pUploadForm(new UploadForm)
    , m_pAnswerForm(new AnswerForm)
{
    ui->setupUi(this);
    connect(m_pMainForm, &MainForm::switchSig, [&](int i) {
        clearLayout(ui->gridLayout);
        if (i == 0)
            ui->gridLayout->addWidget(m_pUploadForm);
        else
        {
            ui->gridLayout->addWidget(m_pAnswerForm);
            m_pAnswerForm->Init();
        }
        ui->pushButton->setHidden(false);
        });
    on_pushButton_clicked();
    setMinimumSize(1400, 1000);
}

MainWindow::~MainWindow()
{
    delete ui;
}


void MainWindow::on_pushButton_clicked()
{
    clearLayout(ui->gridLayout);
    ui->gridLayout->addWidget(m_pMainForm);
    ui->pushButton->hide();
}
